#include <linux/init.h>
#include <linux/module.h>
#include <linux/of.h>

/*
	mynode@0x12345678{
		compatible = "hqyj, mynode";
		astring = "i am ok";
		uint = <0x11223344>;
		binint = [00 0c 29 78 f8 be];
		mixed = "dc2022", <0x8899aabb>, [01 02 03 04];
	};
*/

MODULE_LICENSE("GPL");

static struct device_node* node;

static int __init dt_demo_init(void)
{
    node = of_find_node_by_path("/mynode@0x12345678");
    if(!node) printk("of_find_node_by_path(\"/mynode@0x12345678\") is not find node");
    node = of_find_node_by_name(NULL, "mynode");
    if(!node) printk("of_find_node_by_name(NULL, \"mynode\") is not find node");
    node = of_find_compatible_node(NULL,NULL,"hqyj,mynode");
    if(!node)
    {
        printk("of_find_compatible_node(NULL,NULL,:\"hqyj,mynide\") is not find node");
        printk("not find spec node!\n");
        return -ENODEV;
    }

    printk("node name = %s, full name = %s\n", node->name, node->full_name);
    printk("%s=%s\n", node->properties->name, (char*)node->properties->value);
    return 0;
}

static void __exit dt_demo_exit(void)
{

}

module_init(dt_demo_init);
module_exit(dt_demo_exit);